<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function* foo() {
        yield t1();
        yield t2();
        return;
        console.log(3);
      }
      let a = foo();
      a.next();
      function t1() {
        setTimeout(() => {
          console.log(2);
          a.next();
        }, 3000);
      }
      function t2() {
        setTimeout(() => {
          console.log(33);
          a.next();
          a.next();
        }, 2000);
      }
      function* foo1() {
        yield 2;
        yield 3;
        return 4;
      }
      let a1 = foo1();
      console.log(a1.next());
    </script>
  </body>
</html>
